<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>


<html:html>
<head>
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/stkissue2.css" />

<script type="text/javascript" >
function returnToMainForm(lineNumber, itemOffset) {
	
	var	itemCode	= 	document.getElementById("itemCode"+itemOffset).innerHTML;
	if(lineNumber==1) {
		opener.document.getElementById("suggestDeptPay").value = itemCode;
	}else {
		opener.document.getElementById("departCode").value = itemCode;
	}								

	window.close(); 
}
</script>
<style>

.odd{background-color:#fFA700; }
.even{background-color:#EE0000; }

.menu-over{background-color:#64b1ff;}

</style>	
</head>

<body onload="document.getElementById('itemFind').focus();"><br />
	<center>
		
		<div><center>รหัสแผนก</center>
		<table border="1">
			
			<tr class="odd">
				<td width="20">No.</td>
				<td width="40">Code</td>
				<td width=200>Name</td>
				
			</tr>
			<logic:notEmpty name="departmentList">
				<logic:iterate id="var" name="departmentList" indexId="id">
					
						<tr onmouseover="this.className='menu-over'" 
							onmouseout="this.className='even'" class="even">
							<td>${id+1+offset }.</td>
							<td><a href="#" onclick="returnToMainForm(${lineNumber},${id+1+offset })" >
									<label id="itemCode${id+1+offset }" style="cursor:pointer">${var.code }</label>
								</a>
							</td>
							<td><label id="itemName${id+1+offset }">${var.name }</label></td>
						</tr>					
				</logic:iterate>
			</logic:notEmpty>
		</table>
		
		</div>
		
		
	</center>
					

<input type="hidden" value="${monthFind }" id="monthFindId">
<script type="text/javascript">

	var item2 = document.getElementById("monthFindId").value;	
	document.formSearch.monthFind[item2-1].selected=true;
	
</script>


</body>

</html:html>